import QtQuick 2.0
import VPlay 2.0

// is shown at game start and shows the maximum highscore and a button for starting the game
SceneBase {

    property alias preferences: myLocalStorage

    onBackPressed: {
        window.state = "main"
    }

    // this allows navigation through key presses
    Keys.onReturnPressed: {
        window.state = "main"
    }

    // use the hd-graphics right now with 649x960 resolution, because it was faster during development
    // in the end, a MultiResolutionImage should be used and 3 different formats of the image provided (-sd, -hd and -hd2)!
    MultiResolutionImage {
        source: "../assets/img/gameover_background.png"
        anchors.centerIn: parent
    }

    Column {
        anchors.horizontalCenter: parent.horizontalCenter
        y: 120

        MenuText {
            text: "Preferences"
        }

        MenuButton {
            id:accButton
            text: settings.getValue("accelerometerEnabled") ? "Use Motion" : "Use Buttons"

            onClicked: {
                settings.setValue("accelerometerEnabled",!settings.getValue("accelerometerEnabled"));
                accButton.text = settings.getValue("accelerometerEnabled") ? "Use Motion" : "Use Buttons"
                console.debug("acc changed:", settings.getValue("accelerometerEnabled"));
            }

            // this button should only be displayed on Symbian & Meego, because on the other platforms the volume hardware keys work; but on Sym & Meego the volume cant be adjusted as the hardware volume keys are not working
            // also, display it when in debug build for quick toggling the sound
            visible: system.debugBuild || system.isPlatform(System.Android) || system.isPlatform(System.IOS)
        }

        MenuButton {
            text: settings.musicEnabled ? "Sound on" : "Sound off"

            //          width: 100
            //          height: 100

            onClicked: settings.musicEnabled = !settings.musicEnabled


            // this button should only be displayed on Symbian & Meego, because on the other platforms the volume hardware keys work; but on Sym & Meego the volume cant be adjusted as the hardware volume keys are not working
            // also, display it when in debug build for quick toggling the sound
            visible: system.debugBuild || system.isPlatform(System.Android) || system.isPlatform(System.IOS)
        }

    }

    Storage {
        id: myLocalStorage
    }

    MenuButton {
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 30

        text: "Back"

        onClicked: window.state = "main"
    }
}
